import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '面试时间',
    align: "center",
    sorter: true,
    dataIndex: 'interviewDate'
  },
  {
    title: '面试官',
    align: "center",
    sorter: true,
    dataIndex: 'interviewer_dictText'
  },
  {
    title: '项目',
    align: "center",
    dataIndex: 'projectId_dictText'
  },
  {
    title: '预计入场时间',
    align: "center",
    sorter: true,
    dataIndex: 'estimatedEntryTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '面试链接',
    align: "center",
    dataIndex: 'interviewerLink'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "面试时间",
    field: 'interviewDate',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
  {
    label: "面试官",
    field: 'interviewer',
    component: 'JSelectMultiple',
    componentProps: {
      dictCode: "tm_interviewer_manage,realname,interviewer"
    },
    //colProps: {span: 6},
  },
  {
    label: "预计入场时间",
    field: 'estimatedEntryTime',
    component: 'DatePicker',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '面试时间',
    field: 'interviewDate',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入面试时间!'},
             ];
    },
  },
  {
    label: '面试官',
    field: 'interviewer',
    component: 'JSelectMultiple',
    componentProps:{
        dictCode:"tm_interviewer_manage,realname,interviewer"
     },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入面试官!'},
             ];
    },
  },
  {
    label: '预计入场时间',
    field: 'estimatedEntryTime',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入预计入场时间!'},
             ];
    },
  },
  {
    label: '面试链接',
    field: 'interviewerLink',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  interviewDate: {title: '面试时间',order: 0,view: 'datetime', type: 'string',},
  interviewer: {title: '面试官',order: 1,view: 'list_multi', type: 'string',dictTable: "tm_interviewer_manage", dictCode: 'interviewer', dictText: 'realname',},
  estimatedEntryTime: {title: '预计入场时间',order: 2,view: 'date', type: 'string',},
  interviewerLink: {title: '面试链接',order: 3,view: 'textarea', type: 'string',},
};
